<!DOCTYPE html>
<html lang="en">
	<head>
		<meta charset="UTF-8">
		<title>监督管理下的药品品目维护</title>
        <style type="text/css">
            td{
                height: 25px;
                width: 100px;
                border: #3a8ee6 1px solid;

            }
            input{
                height: 21px;
            }
        </style>

        <script type="text/javascript" src="../../js/jquery-3.3.1.js"></script>
        <script src="https://cdn.staticfile.org/twitter-bootstrap/3.3.7/js/bootstrap.min.js"></script>
        <script src="https://cdn.staticfile.org/jquery/2.1.1/jquery.min.js"></script>
        <link rel="stylesheet" href="https://cdn.staticfile.org/twitter-bootstrap/3.3.7/css/bootstrap.min.css">
        <!--<script type="text/javascript" src="../../js/drugc/01.js"></script>-->

        <script type="text/javascript" src="../../js/01/daoru/druga/findAll.js"></script>
        <script type="text/javascript" src="../../js/01/daoru/druga/feny.js"></script>
        <script type="text/javascript" src="../../js/01/daoru/finddiName.js"></script>
        <script type="text/javascript" src="../../js/01/daoru/daoru.js"></script>
        <script type="text/javascript">
            $(function () {
                gets()
                //查询所有药品类别
                $.ajax({
                    url:"/myspringboot/DrugCategoryController/fandAllDrugCategory",
                    data:"",
                    type:"post",
                    dataType:"json",
                    success:function(result){
                        console.log(result);
                        var result = result.data;
                        var opts = "";
                        for (var i = 0; i < result.length; i++) {
                            var dcId = result[i].dcId;
                            var dcName = result[i].dcName;
                            var opt = '<option value="'+dcId+'">'+dcName+'</option>';
                            opts += opt;
                        }
                        $(".b").append(opts);
                    }
                })
            })
        </script>
        <script type="text/javascript">
            //回显
                    function selectById1(diId) {
                    $.ajax({
                        url: "/myspringboot/selectSampleById",
                        data: {
                            diId: diId,
                        },
                        type: "post",
                        dataType: "json",
                        success: function (result) {
                            var result = result.data;
                            $("#diId").val(diId)
                            $("#daNumber").val(result.drugAtegory.daNumber);
                            $("#diName").val(result.diName);
                            $("#diForm").val(result.diForm);
                            $("#diSpecifications").val(result.diSpecifications);
                            $("#diUnit").val(result.diUnit);
                            $("#diCc").val(result.diCc);
                            $("#diDaCategory").val(result.diDaCategory);
                            $("#diState").val(result.diState);
                            $("#daId").val(result.drugAtegory.daId);
                        }
                })

                //编辑
                    $.ajax({
                        url: "/myspringboot/selectSampleById",
                        data: {
                            diId: diId,
                        },
                        type: "post",
                        dataType: "json",
                        success: function (result) {
                            var result = result.data;
                            $("#daNumber1").val(result.drugAtegory.daNumber);
                            $("#diName1").val(result.diName);
                            $("#diForm1").val(result.diForm);
                            $("#diSpecifications1").val(result.diSpecifications);
                            $("#diUnit1").val(result.diUnit);
                            $("#diCc1").val(result.diCc);
                            $("#diDaCategory1").val(result.drugCategory.dcName);//drugCategory 是实体类一对一配置的drugCategory
                            var a = null;
                            if(result.diState==0){
                                a="正常"
                            }else{
                                a="异常"
                            }
                            $("#diState1").val(a);
                        }
                })
            }

            function update(diId) {
                var a =$("#update11").serializeArray()
                $.ajax({
                    url: '/myspringboot/DrugInformationController/updateDrugInformation',
                    type: 'POST',
                    dataType: "json",
                    data:a,
                    success:function (result) {
                         alert(result.msg)
                      window.location.href="drug01.html"
                    }
                })

            }

        </script>
	</head>
	<body>
		<div>
            <table class="" style="border: 1px solid #999;border-collapse:collapse">
                <tr>
                    <h3 style="height: 50px" >药品品目查询</h3>


                </tr>
                <tr>
                    <td>药品品目号：</td>
                    <td><input id="number" name="number" type="text" value=""></td>
                    <td></td>
                    <td>通用名：</td>
                    <td><input id="cname" name="cname" type="text" value=""></td>
                    <td></td>
                </tr>
                <tr>
                    <td>剂型：</td>
                    <td><input id="jixing" name="jixing" type="text" value=""></td>
                    <td></td>
                    <td>规格：</td>
                    <td><input id="guige" name="guige" type="text" value=""></td>
                    <td></td>
                 </tr>
                <tr>
                    <td>单位：</td>
                    <td><input id="danwei" name="danwei" type="text" value=""></td>
                    <td></td>
                    <td>转换系数：</td>
                    <td><input id="cc" name="cc" type="text" value=""></td>
                    <td></td>
                </tr>
                <tr>
                    <td>药品类别：</td>
                    <td>
                        <select id="dcid" name="leibie"  style=" height: 25px; width: 160px;" class="b">
                            <option value="">请选择</option>
                        </select>
                    </td>
                    <td></td>
                    <td>状态：</td>
                    <td>
                        <select id="zhuangtai" name="zhuangtai" style=" height: 25px; width: 160px;">
                            <option value="">请选择</option>
                            <option value="0">正常</option>
                            <option value="1">异常</option>
                        </select>
                    </td>
                    <td></td>
                </tr>
            </table>
            <td>
                &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                <button type="reset"  onclick="gets()">查询</button>
                <a href="/myspringboot/DrugInformationController/getExcel"><button>导出</button></a>
            </td>
            <br>
            <td>
                <a href="./add.html"><button>添加</button></a>
                <button data-toggle="modal" data-target="#myModal">导入</button>
            </td>
            <br>
        </div>
        <iframe id="iframe" name="rfFrame" src="about:blank" style="display:none;"></iframe>
        <div>
            <table ><!--class="a"-->
                <tr>
                    <td>药品品目号</td>
                    <td>通用名</td>
                    <td>剂型</td>
                    <td>规格</td>
                    <td>单位</td>
                    <td>转换系数</td>
                    <td>药品类别</td>
                    <td>状态</td>
                    <td>详细</td>
                    <td>修改</td>
                    <td>删除</td>
                </tr>
                <tbody class="a"></tbody>
            </table>
		</div>

        <div class="im-page" id="impage">
            <tr>
                <td><button id='first'>首页</button></td>
                <td><button id='before'>上一页</button></td>
                <td>第<span id="pnum"></span>页</td>
                <td>共<span id="ptotal"></span>页</td>
                <td><button  id='next'>下一页</button></td>
                <td><button id='last'>尾页</button></td>
            </tr>
        </div>


        <!--药品导入模态框  模态框（Modal） -->
        <div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
            <div class="modal-dialog">
                <div class="modal-content">
                    <div class="modal-header">
                        <button type="button" class="close" data-dismiss="modal"
                                aria-hidden="true">×
                        </button>
                        <h4 class="modal-title" id="myModalLabel">
                            药品品目导入
                        </h4>
                    </div>

                    <form action="/myspringboot/inputExcel" enctype="multipart/form-data" method="post" accept-charset="utf-8">
                    <div class="modal-body">
                            下载导入模板文件 <a href="/myspringboot/DrugInformationController/download">点击下载药品品目导入模板</a>
                            <hr>
                            提示:请下载后在模板文件中录入药品品目信息,在下边的"选择文件"中选择要导入的文件,点击"导入"
                            <input type="file" name="file" accept=".xlsx"><br>
                            <a><button type="submit" class="btn btn-primary">导入</button></a>
                            <a><button class="btn btn-primary">查看导入失败结果</button></a>
                            <a>
                                <button type="button" data-dismiss="modal" class="btn btn-primary">关闭</button>
                            </a>

                        </div>
                    </form>
                    <div class="modal-footer">
                    </div>
                </div><!-- /.modal-content -->
            </div><!-- /.modal-dialog -->
        </div><!-- /.modal -->

        <!--编辑药品模态框  模态框（Modal） -->
        <div class="modal fade" id="Update" tabindex="-1" role="dialog" aria-labelledby="Update1" aria-hidden="true">
            <div class="modal-dialog">
                <div class="modal-content">
                    <div class="modal-header">
                        <button type="button" class="close" data-dismiss="modal"
                                aria-hidden="true">
                        </button>
                        <h4 class="modal-title" id="Update1">
                            编辑药品品目
                        </h4>
                    </div>
                        <div class="modal-body">
                            <form action="/myspringboot/DrugInformationController/updateDrugInformation" id="update11">
                                <table>
                                    <!-- 用来存放修改的主键 -->
                                    <!--<input type="hidden" id="diId">-->
                                    <tr>
                                        编辑药品品目
                                    </tr>
                                    <tr>
                                        <input name="diId" id="diId" type="hidden">
                                        <input name="daId" id="daId" type="hidden">
                                        <td>药品品目号：</td>
                                        <td><input type="text" name="daNumber" value="" id="daNumber"></td>
                                        <td></td>
                                        <td>通用名：</td>
                                        <td><input type="text" name="diName" value="" id="diName" class="ddName" onblur="finddiName()"></td>
                                        <td></td>
                                    </tr>
                                    <tr>
                                        <td>剂型：</td>
                                        <td><input type="text" name="diForm" value="" id="diForm"></td>
                                        <td></td>
                                        <td>规格：</td>
                                        <td><input type="text" name="diSpecifications" value="" id="diSpecifications"></td>
                                        <td></td>
                                    </tr>
                                    <tr>
                                        <td>单位：</td>
                                        <td><input type="text" name="diUnit" value="" id="diUnit"></td>
                                        <td></td>
                                        <td>转换系数：</td>
                                        <td><input type="text" name="diCc" value="" id="diCc"></td>
                                        <td></td>
                                    </tr>
                                    <tr>
                                        <td>药品类别：</td>
                                        <td>
                                            <select style=" height: 25px; width: 160px;" name="diDaCategory" class="b" id="diDaCategory">
                                                <option value="">请选择</option>
                                            </select>
                                        </td>
                                        <td></td>
                                        <td>状态：</td>
                                        <td>
                                            <select style=" height: 25px; width: 160px;" name="diState" id="diState">
                                                <option value="">请选择</option>
                                                <option value="0">正常</option>
                                                <option value="1">异常</option>
                                            </select>
                                        </td>
                                        <td></td>
                                    </tr>
                                </table>
                            </form>
                                <td>
                                    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                                    <button onclick="update()" class="btn btn-primary">提交</button>
                                    <button type="button" data-dismiss="modal" class="btn btn-primary">关闭</button>
                                </td>
                        </div>
                    <div class="modal-footer">
                    </div>
                </div><!-- /.modal-content -->
            </div><!-- /.modal-dialog -->
        </div><!-- /.modal -->





        <!--查看药品模态框  模态框（Modal） -->
        <div class="modal fade" id="Check" tabindex="-1" role="dialog" aria-labelledby="Check1" aria-hidden="true">
            <div class="modal-dialog">
                <div class="modal-content">
                    <div class="modal-header">
                        <button type="button" class="close" data-dismiss="modal"
                                aria-hidden="true">
                        </button>
                        <h4 class="modal-title" id="Check1">
                            查看药品品目
                        </h4>
                    </div>
                    <div class="modal-body">
                        <table>
                            <!-- 用来存放修改的主键 -->
                            <!--<input type="hidden" id="diId">-->
                            <tr>
                                查看药品品目
                            </tr>
                            <tr>
                                <td>药品品目号：</td>
                                <td><input type="text" value="" id="daNumber1" readonly="readonly"></td>
                                <td></td>
                                <td>通用名：</td>
                                <td><input type="text" value="" id="diName1" readonly="readonly"></td>
                                <td></td>
                            </tr>
                            <tr>
                                <td>剂型：</td>
                                <td><input type="text" value="" id="diForm1" readonly="readonly"></td>
                                <td></td>
                                <td>规格：</td>
                                <td><input type="text" value="" id="diSpecifications1" readonly="readonly"></td>
                                <td></td>
                            </tr>
                            <tr>
                                <td>单位：</td>
                                <td><input type="text" value="" id="diUnit1" readonly="readonly"></td>
                                <td></td>
                                <td>转换系数：</td>
                                <td><input type="text" value="" id="diCc1" readonly="readonly"></td>
                                <td></td>
                            </tr>
                            <tr>
                                <td>药品类别：</td>
                                <td>
                                    <input style=" height: 25px; width: 160px;" class="b" id="diDaCategory1" readonly="readonly">
                                        <!--<option value="">请选择</option>-->
                                    </input>
                                </td>
                                <td></td>
                                <td>状态：</td>
                                <td>
                                    <input style=" height: 25px; width: 160px;" id="diState1" readonly="readonly">

                                    </input>
                                </td>
                                <td></td>
                            </tr>
                        </table>
                        <td>
                            &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                            <button type="button" data-dismiss="modal" class="btn btn-primary">关闭</button>
                        </td>
                    </div>
                    <div class="modal-footer">
                    </div>
                </div><!-- /.modal-content -->
            </div><!-- /.modal-dialog -->
        </div><!-- /.modal -->
	</body>
</html>
